package ipad.asia.dao;

import ipad.asia.entity.Consumer;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ConsumerDao extends JpaRepository<Consumer,Long> {
    Consumer findByUserAndPassword(String user, String password);
    Consumer findById(int id);
    Consumer findByUser(String user);
    @Modifying
    @Query("update Consumer set phone=?2,email=?3,sex=?4,address=?5,signature=?6 where user=?1")
    void updateInfo(String user,String phone,String email,String sex,String address,String signature);
    List<Consumer> findAll();
}
